<template>
	<div class="shoparea-list">
		<ul>
			<li class="shoparea-litem">
				<p>商品名称</p>
				<input type="text" placeholder="请输入商品名称" v-model="shopname"/>
			</li>
			<li class="shoparea-litem">
				<p>商品价格(元)</p>
				<input type="number" placeholder="请输入商品价格" v-model="shop_pre"/>
			</li>
			<li class="shoparea-litem">
				<p>分销佣金(元)</p>
				<input type="number" placeholder="请输入佣金" v-model="shop_fenx"/>
			</li>
			<li class="shoparea-litem">
				<p>库存(件)</p>
				<input type="number" placeholder="请输入库存" v-model="shop_kc"/>
			</li>
		</ul>
		<p class="shoparea-qtxinxi">其他信息的编辑请在电脑上操作</p>
		<div class="shoparea-send" @click="xiugaishop">确定</div>
	</div>
</template>

<script>
	export default{
		name:'shoparea',
		data () {
			return{
				user:0,
				shopid:0,
				shopname:"",
				shop_pre:'',
				shop_fenx:'',
				shop_kc:''
			}
		},
		created:function(){
			this.user=localStorage.getItem("nt_user");
			this.shopid=this.$route.query.spid;
		},
		mounted:function(){
			var self=this;
			$.ajax({
				type:'get',
				url:furl+"index.php?app=ajax_seller_member&act=edit",
				data:{'token':self.user,'goods_id':self.shopid},
				dataType:'json',
				success:function(res){
					self.shopname=res.retval.goods_name;
					self.shop_pre=res.retval.price;
					self.shop_fenx=res.retval.commission;
					self.shop_kc=res.retval.stock;
				}
			})
		},
		methods:{
			xiugaishop:function(){
				var self=this;
				$.ajax({
				type:'post',
				url:furl+"index.php?app=ajax_seller_member&act=edit",
				data:{'token':self.user,'goods_id':self.shopid,'goods_name':self.shopname,'price':self.shop_pre,'commission':self.shop_fenx,'stock':self.shop_kc},
				dataType:'json',
				success:function(res){
					if(res.done){
						history.go(-1);
					}
				}
			})
			}
		}
	}
</script>

<style>
	.shoparea-list{font-size:0;}
	.shoparea-list>ul{background-color:#fff;padding-left:0.32rem;padding-right:0.32rem;}
	.shoparea-litem{border-bottom:1px solid #d6d6d6;padding-top:0.24rem;padding-bottom:0.24rem;}
	.shoparea-litem:last-child{border-bottom:0px solid #fff;}
	.shoparea-litem>p{font-size:0.28rem;color:#FF9C03;line-height: 0.5rem;}
	.shoparea-litem>input{color:#2B2B2B;font-size:0.32rem;line-height: 0.64rem;height:0.64rem;width:100%;}
	.shoparea-qtxinxi{font-size:0.24rem;color:#999;line-height: 0.76rem;padding-left: 0.32rem;}
	.shoparea-send{width:6.86rem;height:1rem;border-radius:0.5rem;text-align: center;line-height: 1rem;box-sizing: border-box;margin:0.26rem auto;color:#fff;letter-spacing: 0.2rem;padding-left: 0.2rem;font-size:0.36rem;
	background: -webkit-linear-gradient(left, #ffbb03 , #ff9c03); background: -o-linear-gradient(right, #ffbb03, #ff9c03); background: -moz-linear-gradient(right, #ffbb03, #ff9c03);background: linear-gradient(to right, #ffbb03 , #ff9c03);}
</style>